Imports Pacientes
Imports System.Data.SqlClient
Public Class frmModificarFIa
    Private Paci As Paciente = Nothing
    Private TipoDoc As TipoDocumento = Nothing
    Private Fia As Fia = Nothing

    Public Property Paciente() As Paciente
        Get
            Return paci
        End Get
        Set(ByVal value As Paciente)
            paci = value
        End Set
    End Property
    Private Sub cmdBuscar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdBuscar.Click
        banModiFia = 3
        Dim tipDoc As TipoDocumento = Nothing
        Dim idTipoDoc As Integer
        Dim barrio As Barrio = Nothing
        Dim frm As SelecPaciente = New SelecPaciente()
        frm.ShowDialog(Me)
        frm.Dispose()

        With Me.Paciente
            txtApeNom.Text = .NombrePer + " " + .ApellidoPer
            txtNroDoc.Text = .NroDocumentoPer

            tipDoc = New TipoDocumento()
            If tipDoc.Buscar(.tipodocumentoPer, conexion) Then
                cboTipo.Text = tipDoc.Descripcion
                idTipoDoc = tipDoc.TipoDoc
            End If

            Dim datos As DataSet = Nothing
            Fia = New Fia()
            datos = Fia.BuscarDatos(idTipoDoc, txtNroDoc.Text, conexion)
            Me.cboNroFia.DataSource = datos.Tables(0)
            Me.cboNroFia.DisplayMember = "numfia"
            Me.cboNroFia.ValueMember = "numfia"

            ' cboNroFia.Text = ""
        End With
    End Sub

    Private Sub cargarComboTipoDoc()
        Dim datos As DataSet = Nothing
        TipoDoc = New TipoDocumento()
        datos = TipoDoc.BuscarDatos(conexion)
        Me.cboTipo.DataSource = datos.Tables(0)
        Me.cboTipo.DisplayMember = "descrip"
        Me.cboTipo.ValueMember = "idtipodoc"

        'busca por letra el indice del combo
        Dim index As Integer = 0
        index = Me.cboTipo.FindString(Me.cboTipo.Text)
        Me.cboTipo.SelectedIndex = index

        cboTipo.Text = ""

    End Sub
    Private Sub frmModificarFIa_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            cargarComboTipoDoc()
    End Sub
    Private Sub cboNroFia_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboNroFia.Click
        Dim datos As DataSet = Nothing
        Dim xfia As Integer = 0
        Dim Fia As Fia = Nothing
        Fia = New Fia()
        xfia = cboNroFia.Text
        With Me.Fia
            datos = Fia.BuscarFia(xfia, conexion)
            'mostrar datos
            grFia.AutoGenerateColumns = False
            grFia.DataSource = datos
            grFia.DataMember = "detallefia"
        End With
    End Sub
    Private Sub grFia_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles grFia.CellContentClick
        If grFia.Columns(e.ColumnIndex).Name = "colCheck" Then
            Dim a As Integer = 0
            Dim celda As DataGridViewButtonCell = _
                CType(Me.grFia.Rows(e.RowIndex).Cells("colCheck"), DataGridViewButtonCell)
            a = grFia.Rows(e.RowIndex).Cells("idestudio").Value
            If a = 1 Then
                Dim frm As RdoOrina = New RdoOrina()
                frm.ShowDialog(Me)
                frm.Dispose()
            End If
            If a = 2 Then
                Dim frm As RdoHemograma = New RdoHemograma()
                frm.ShowDialog(Me)
                frm.Dispose()
            End If
            If a = 3 Then
                Dim frm As frmAnalisisAgua = New frmAnalisisAgua()
                frm.ShowDialog(Me)
                frm.Dispose()
            End If
            If a = 4 Then
                Dim frm As frmRdoExudadoVaginal = New frmRdoExudadoVaginal()
                frm.ShowDialog(Me)
                frm.Dispose()
            End If
        End If
    End Sub

   
End Class